package com.hzlj.position.config.converter;

import java.util.Date;

import com.hzlj.position.config.common.dto.jzJbxxDeviceBindHistory.JzJbxxDeviceBindHistoryAddDTO;
import com.hzlj.position.config.common.dto.jzJbxxDeviceBindHistory.JzJbxxDeviceBindHistoryQueryResultDTO;
import com.hzlj.position.config.common.model.JzJbxxDeviceBindHistory;
import com.fz.common.base.converter.ModelDTOConverter;
import com.fz.common.base.core.date.DateUtils;

/**
 * 设备绑定历史表(JzJbxxDeviceBindHistory)DTO转换类
 *
 * @author lifh
 * @date 2023-03-30 20:52:49
 */
public class JzJbxxDeviceBindHistoryConverter {
    /**
     * model实例转换为查询结果DTO
     *
     * @param model model实例
     * @return DTO
     */
    public static JzJbxxDeviceBindHistoryQueryResultDTO from(JzJbxxDeviceBindHistory model) {
        return ModelDTOConverter.from(model, JzJbxxDeviceBindHistoryQueryResultDTO.class);
    }

    /**
     * 新增DTO转换为model实例
     *
     * @param dto 新增DTO
     * @return model实例
     */
    public static JzJbxxDeviceBindHistory from(JzJbxxDeviceBindHistoryAddDTO dto) {
        return ModelDTOConverter.from(dto, JzJbxxDeviceBindHistory.class, (JzJbxxDeviceBindHistory l) -> {
            l.setCreateTime(DateUtils.now());
        });

    }
}
